#ifndef CUSTOMER_H
#define CUSTOMER_H

#include <QWidget>
#include <QDesktopWidget>

#include "dbconnection.h"

namespace Ui {class Customer;}

class Customer : public QWidget
{
    Q_OBJECT

public:         
    explicit Customer(QWidget *parent = 0);
    ~Customer();

    void getCustomers(QSqlQueryModel* model);
    void setCustomer(QString id);
    void deleteCustomer(QString id);

signals:
    void updateCostumer();
    void updateOrders();

private:
    Ui::Customer *ui;

    static const QString QUERY_ALL_CUSTOMERS;

    QString _currentCustomerId;

    void centerOnScreen();
    void clearForm();
    void loadCustomer();
    bool hasPedidos(QString id);

private slots:
    void accept();
    void close();
};

#endif // CUSTOMER_H
